package com.aids_malaria.adapter;

import android.content.Context;

import com.aids_malaria.R;
import com.aids_malaria.base.BaseQuickAdapter;
import com.aids_malaria.base.BaseViewHolder;
import com.aids_malaria.http.response.DataQueryResponse;

import java.util.List;

public class DataQueryAdapter extends BaseQuickAdapter<DataQueryResponse> {

    private Context context;

    public DataQueryAdapter(Context context, int layoutResID, List<DataQueryResponse> data) {
        super(context, layoutResID, data);
        this.context = context;
    }

    @Override
    public void convert(BaseViewHolder holder, DataQueryResponse item) {
        if (holder.getAdapterPosition() % 2 > 0){
            holder.getView(R.id.item).setBackgroundColor(context.getResources().getColor(R.color.c_item2));
        }else {
            holder.getView(R.id.item).setBackgroundColor(context.getResources().getColor(R.color.c_item1));
        }

        holder.setText(R.id.tv_village_name,item.getVillage_name());
        holder.setText(R.id.tv_name,item.getName());
        holder.setText(R.id.tv_heal,item.getDiagnosis_info());
        holder.setText(R.id.tv_medical,item.getMedical_treatment_info());
    }
}
